package com.hhsjdesign.dynamicui.utils

import android.graphics.Color
import java.util.regex.Pattern

class ImageSource {

    companion object {
        const val SOURCE_TYPE_COLOR_STR = 0
        const val SOURCE_TYPE_IMAGE = 1
        const val SOURCE_TYPE_LOCAL_THEME = 2

        //argb或者rgb
        const val pattern: String = "^#(([0-9a-fA-F]{6}\\b)|([a-f0-9A-F]{8}\\b))\$"

        @JvmStatic
        fun checkColor(colorStr: String): Boolean = Pattern.matches(pattern, colorStr)
    }

    //背景类型
    var sourceType: Int = 0

    //背景资源
    var sourceValue: String? = null

    //颜色值
    var sourceColorInt: Int = Color.TRANSPARENT

    //本地资源
    var sourceColorThemeCode: String = "s1"

}